import { defHttp, jsonHttp } from '@/utils/http/axios';
import { listParams, detailParams, createGroupChatParams } from './model/chatGroupModel';
import { BasicListResult, BasicDataResult } from '../model/baseModel';

import { ErrorMessageMode } from '#/axios';
import { deptListParams } from '@/api/sys/model/deptModel';
import { saveParams } from '@/api/sys/model/userModel';

enum Api {
  Login = '/hl/ms/user/userLogin/login',
  mouldList = '/hl/sys/ms/mould/mouldList',
  addMould = '/hl/sys/ms/mould/addMould',
  editMould = '/hl/sys/ms/mould/editMould',
  detailMould = '/hl/sys/ms/mould/detailMould',
  closeMould = '/hl/sys/ms/mould/closeMould',
  deleteMould = '/hl/sys/ms/mould/deleteMould',
  getMouldItems = '/hl/sys/ms/mould/getMouldItems',
  dictDelete = '/hl/sys/ms/mould/dictDelete',
  dictDetail = '/hl/sys/ms/mould/dictDetail',
  dictList = '/hl/sys/ms/mould/dictList',
  dictAllList = '/hl/sys/ms/mould/dictAllList',
  dictSave = '/hl/sys/ms/mould/dictSave',
  materialList = '/hl/sys/ms/mould/materialList',
  materialTableList = '/hl/sys/ms/mould/materialTableList',
  outsourceOrderTableList = '/hl/sys/ms/mould/outsourceOrderTableList',
  purchaseOrderTableList = '/hl/sys/ms/mould/purchaseOrderTableList',
  priceTableList = '/hl/sys/ms/mould/priceTableList',
  supplierList = '/hl/sys/ms/mould/supplierList',
  supplierTableList = '/hl/sys/ms/mould/supplierTableList',
  importMsOrderExcel = '/hl/sys/ms/mould/importMsOrderExcel',
}

/**
 * @description: user login api
 */
export function LoginH5Api(params: null, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.Login,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function mouldListApi(params: null, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.mouldList,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function addMouldApi(params: null, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.addMould,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function editMouldApi(params: null, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.editMould,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function detailMouldApi(params: null, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.detailMould,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function deleteMouldApi(params: null, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.deleteMould,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function closeMouldApi(params: null, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.closeMould,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function getMouldItemsApi(params: null, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.getMouldItems,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function dictDeleteApi(params: null, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.dictDelete,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function dictDetailApi(params: null, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.dictDetail,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function dictListApi(params: null, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.dictList,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function dictAllListApi(params: null, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.dictAllList,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function dictSaveApi(params: null, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.dictSave,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function materialListApi(params: null, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.materialList,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function materialTableListApi(params: null, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.materialTableList,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function outsourceOrderTableListApi(params: null, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.outsourceOrderTableList,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function purchaseOrderTableListApi(params: null, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.purchaseOrderTableList,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function priceTableListApi(params: null, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.priceTableList,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function supplierListApi(params: null, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.supplierList,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function supplierTableListApi(params: null, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.supplierTableList,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function importMsOrderExcelApi(params: saveParams, mode: ErrorMessageMode = 'modal') {
  // jsonHttp defHttp
  return jsonHttp.post<BasicDataResult>(
    {
      url: Api.importMsOrderExcel,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
